package com.jxfgyj.service.impl;

import java.util.List;

import com.jxfgyj.dao.TeacherDao;
import com.jxfgyj.domain.DO.jxfgyj_teacher;
import com.jxfgyj.service.TeacherService;
import com.jxfgyj.service.VideoService;
import com.jxfgyj.util.UuidUtil;

public class TeacherServiceImpl implements TeacherService {

	private TeacherDao teacherDao;
	private VideoService videoService;

	/* 
	 * 
	 */
	public TeacherDao getTeacherDao() {
		return teacherDao;
	}

	public VideoService getVideoService() {
		return videoService;
	}

	public void setVideoService(VideoService videoService) {
		this.videoService = videoService;
	}

	public void setTeacherDao(TeacherDao teacherDao) {
		this.teacherDao = teacherDao;
	}

	/*
	 * 
	 * 
	 * 
	 */
	@Override
	public boolean createTeacher(jxfgyj_teacher teacher) {
		teacher.setTeacher_id(UuidUtil.getUuid());
		return teacherDao.createTeacher(teacher);
	}

	@Override
	public List<jxfgyj_teacher> listTeacher(String search) {
		return teacherDao.listTeacher(search);

	}

	@Override
	public jxfgyj_teacher getTeacher_byID(jxfgyj_teacher teacher) {
		return teacherDao.getTeacher_byID(teacher.getTeacher_id());
	}

	@Override
	public void deleteTeacher(String teacher_id) {
		teacherDao.deleteTeacher_byID(teacher_id);
		/*
		 * 删除教师时一并删除视频和标注
		 */
		videoService.deleteVideo_byTeacher(teacher_id);
	}
}
